import {WebMapTileServiceImageryProvider} from 'cesium'
import { tdtKey } from '@config/cesiumConf'
//加载天地图影像
export function loadTdtImagery() {
	const imgProvider = new WebMapTileServiceImageryProvider({
		url: 'https://t{s}.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=vec&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={TileMatrix}&TILEROW={TileRow}&TILECOL={TileCol}&tk='+ tdtKey,
		layer: "天地图影像",
		style: "default", 
		format: "image/jpg",
		maximumLevel: 18,
		subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
		tileMatrixSetID: "GoogleMapsCompatible",
	});
	return imgProvider;
}
//加载天地图地图标注
export function loadTdtCia() {
	const ciaProvider = new WebMapTileServiceImageryProvider({
		url: "https://t{s}.tianditu.com/cia_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=cia&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default.jpg&tk=" + tdtKey,
		layer: "天地图中文注记",
		style: "default",
		format: "image/jpeg",
		subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
		tileMatrixSetID: "GoogleMapsCompatible"
	})
	return ciaProvider
}

export const generateRandomId = () => Math.random().toString(36).substring(2, 10)